package com.hctg.forced2sleep.adapter;

import android.text.TextUtils;

import androidx.annotation.NonNull;

import com.actor.myandroidframework.utils.TextUtils2;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hctg.forced2sleep.R;

import java.util.ArrayList;
import java.util.List;

public class AppMonitorSetAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private final String[] weeks = new String[]{"日", "一", "二", "三", "四", "五", "六"};

    public AppMonitorSetAdapter() {
        super(R.layout.item_app_monitor_set);
    }

    @Override // c.g.a.a.a.f
    public void convert(@NonNull BaseViewHolder holder, String canDurationTime) {
        int position = holder.getAbsoluteAdapterPosition();
//        String I = SPUtils.timeLong2Str2(canDurationTime.duration);
//        StringBuilder d2 = new StringBuilder("可使用");
//        if (TextUtils.isEmpty(I)) {
//            I = "0分钟";
//        }
//        d2.append(I);
//        holder.setText(R.id.tv_time, d2.toString());
        holder.setText(R.id.tv_time, TextUtils2.getStringFormat("%d小时%d分钟", position + 1, position * 10));
        ArrayList<String> arrayList = new ArrayList<>();
//        List<Integer> list = canDurationTime.repeat;
//        if (list != null) {
//            for (Integer num : list) {
//                arrayList.add(weeks[num.intValue() - 1]);
//            }
//        }
        int i = position % weeks.length;
        for (; i < weeks.length; i++) {
            arrayList.add(weeks[i]);
        }
        holder.setText(R.id.tv_week, TextUtils.join(" ", arrayList));
    }
}
